/*==============================================================================
pigasus.l
Lex Scanner for the Pigasus Language
By: Philip Tjimos and Sharath Gururaj

Reference: http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
==============================================================================*/

D			[0-9]
L			[a-zA-Z_]
E			[Ee][+-]?{D}+
FS		(f|F)

%{
#include <stdio.h>


%}
%option noyywrap
%%


 /* comments */
\/\*(\/|\**[^\/\*])*\*+\/     { }
\/\/.*			                  { }

 /* key words */
"bool"			{ printf(" BOOL"); }
"break"			{ printf(" BREAK"); }
"connect"		{ printf(" CONNECT"); }
"continue"	{ printf(" CONTINUE"); }
"do"				{ printf(" DO"); }
"else"			{ printf(" ELSE"); }
"false"			{ printf(" FALSE"); }
"file"			{ printf(" FILES"); }
"float"			{ printf(" FLOAT"); }
"for"				{ printf(" FOR "); }
"if"				{ printf(" IF "); }
"int"				{ printf(" INT"); }
"job"				{ printf(" JOB"); }
"length"		{ printf(" LENGTH"); }
"list"			{ printf(" LIST"); }
"loadcsv"		{ printf(" LOADCSV"); }
"map"				{ printf(" MAP"); }
"null"			{ printf(" NULLS"); }
"post"			{ printf(" POST"); }
"postall"		{ printf(" POSTALL"); }
"print"			{ printf(" PRINT"); }
"push"			{ printf(" PUSH"); }
"return"		{ printf(" RETURN"); }
"sizeof"		{ printf(" SIZEOF"); }
"true"			{ printf(" TRUE"); }
"typeof"		{ printf(" TYPEOF"); }
"void"			{ printf(" VOID"); }
"wait"			{ printf(" WAIT"); }
"waitall"		{ printf(" WAITALL"); }
"while"			{ printf(" WHILE"); }

{L}({L}|{D})*		{ printf(" IDENTIFIER"); }
{D}+						{ printf(" CONSTANT"); }

 /* exponentials */
{D}+{E}{FS}?						{ printf(" CONSTANT"); }
{D}*"."{D}+({E})?{FS}?	{ printf(" CONSTANT"); }
{D}+"."{D}*({E})?{FS}?	{ printf(" CONSTANT"); }

\"(\\.|[^\\"])*\"	{ printf(" STRING_LITERAL"); }

 /* comparison operators */
"&&"			{ printf(" AND_OP"); }
"||"			{ printf(" OR_OP"); }
"<="			{ printf(" LE_OP"); }
">="			{ printf(" GE_OP"); }
"=="			{ printf(" EQ_OP"); }
"!="			{ printf(" NE_OP"); }

"=>"			{ printf(" MAPS_TO"); }

 /* other characters */
"@"			{ printf(" '@'"); }
";"			{ printf(" ';'"); }
"{"			{ printf(" '{'"); }
"}"			{ printf(" '}'"); }
","			{ printf(" ','"); }
"="			{ printf(" '='"); }
"("			{ printf(" '('"); }
")"			{ printf(" ')'"); }
"["			{ printf(" '['"); }
"]"			{ printf(" ']'"); }
"."			{ printf(" '.'"); }
"!"			{ printf(" '!'"); }
"-"			{ printf(" '-'"); }
"+"			{ printf(" '+'"); }
"*"			{ printf(" '*'"); }
"/"			{ printf(" '/'"); }
"%"			{ printf(" '%'"); }
"<"			{ printf(" '<'"); }
">"			{ printf(" '>'"); }

[ \t\v\n\f]		{ }
.							{ /* ignore bad characters */ }

%%
int main()
{
	yylex();
	printf("\n");
}